/*
 * Copyright (c) 2024 Black Sesame Technologies
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <gtest/gtest.h>
#include "dal_rticonnextdds/converter/RetTypeConverter.hpp"

TEST(test_ret_type_convert, ret_type_convert)
{
    EXPECT_EQ(RetTypeConverter::GetInstance()->ConvertRetFromRtiddsToDal(
                  DDS_RETCODE_OK),
              DAL_RETCODE_OK);
    EXPECT_EQ(RetTypeConverter::GetInstance()->ConvertRetFromRtiddsToDal(
                  DDS_RETCODE_ERROR),
              DAL_RETCODE_ERROR);
    EXPECT_EQ(RetTypeConverter::GetInstance()->ConvertRetFromRtiddsToDal(
                  DDS_RETCODE_UNSUPPORTED),
              DAL_RETCODE_UNSUPPORTED);
    EXPECT_EQ(RetTypeConverter::GetInstance()->ConvertRetFromRtiddsToDal(
                  DDS_RETCODE_BAD_PARAMETER),
              DAL_RETCODE_BAD_PARAMETER);
    EXPECT_EQ(RetTypeConverter::GetInstance()->ConvertRetFromRtiddsToDal(
                  DDS_RETCODE_PRECONDITION_NOT_MET),
              DAL_RETCODE_PRECONDITION_NOT_MET);
    EXPECT_EQ(RetTypeConverter::GetInstance()->ConvertRetFromRtiddsToDal(
                  DDS_RETCODE_OUT_OF_RESOURCES),
              DAL_RETCODE_OUT_OF_RESOURCES);
    EXPECT_EQ(RetTypeConverter::GetInstance()->ConvertRetFromRtiddsToDal(
                  DDS_RETCODE_NOT_ENABLED),
              DAL_RETCODE_NOT_ENABLED);
    EXPECT_EQ(RetTypeConverter::GetInstance()->ConvertRetFromRtiddsToDal(
                  DDS_RETCODE_IMMUTABLE_POLICY),
              DAL_RETCODE_IMMUTABLE_POLICY);
    EXPECT_EQ(RetTypeConverter::GetInstance()->ConvertRetFromRtiddsToDal(
                  DDS_RETCODE_INCONSISTENT_POLICY),
              DAL_RETCODE_INCONSISTENT_POLICY);
    EXPECT_EQ(RetTypeConverter::GetInstance()->ConvertRetFromRtiddsToDal(
                  DDS_RETCODE_ALREADY_DELETED),
              DAL_RETCODE_ALREADY_DELETED);
    EXPECT_EQ(RetTypeConverter::GetInstance()->ConvertRetFromRtiddsToDal(
                  DDS_RETCODE_TIMEOUT),
              DAL_RETCODE_TIMEOUT);
    EXPECT_EQ(RetTypeConverter::GetInstance()->ConvertRetFromRtiddsToDal(
                  DDS_RETCODE_NO_DATA),
              DAL_RETCODE_NO_DATA);
    EXPECT_EQ(RetTypeConverter::GetInstance()->ConvertRetFromRtiddsToDal(
                  DDS_RETCODE_ILLEGAL_OPERATION),
              DAL_RETCODE_ILLEGAL_OPERATION);
}
